/*
 * bloghomepage.cpp
 *
 *  Created on: Jul 20, 2010
 *      Author: nintang
 */

#include "bloghomepage.h"

bloghomepage::bloghomepage(int i,QWidget *parent)
    : QWidget(parent)
{
	//setWindowFlags(Qt::WindowSoftkeysVisibleHint);         //display the softkeys when fullscreen
    QFont font;
    font.setFamily(QString::fromUtf8("\351\273\221\344\275\223"));
    this->setFont(font);
	QTabWidget *tabWidget=new QTabWidget(this);
	tabWidget->setGeometry(QRect(0, 0, 360, 580));	
	tabWidget->setFocusPolicy(Qt::NoFocus);
	this->setStyleSheet("QTabWidget::pane { border:0px;}"
			"QTabBar::tab { background-image:url(:/images/53.png); border: 0px ;  width:120px; height:62px; color: black; font:bold 20px;}"
			"QTabBar::tab:selected { background-image:url(:/images/52.png); border-style: none ;}"
	        "QPushButton {background-image: url(:/images/22.png);  border-radius: 4px;  color: black; font:bold 20px;}");		
	QWidget *tab1=new QWidget();	
	QWidget *tab2=new QWidget();
	QWidget *tab3=new QWidget();
	tabWidget->addTab(tab1, QString());
	tabWidget->addTab(tab2, QString());
	tabWidget->addTab(tab3, QString());
	//tabWidget->setTabText(tabWidget->indexOf(tab1), QApplication::translate("bloghomepage", "\345\275\251  \351\241\265", 0, QApplication::UnicodeUTF8));
	//tabWidget->setTabText(tabWidget->indexOf(tab2), QApplication::translate("bloghomepage", "\345\276\256  \345\215\232", 0, QApplication::UnicodeUTF8));
	//tabWidget->setTabText(tabWidget->indexOf(tab3), QApplication::translate("bloghomepage", "\346\264\273  \345\212\250", 0, QApplication::UnicodeUTF8));
	tabWidget->setCurrentIndex(i);
	QWidget *widget0=new QWidget(tab1);
	widget0->resize(360,518);
	widget0->move(0,0);
	widget0->setStyleSheet("border:0px;");
	multiListWidget=new multilistwidget(widget0);
	QWidget *widgetScroll=new QWidget(widget0);
	widgetScroll->resize(49,518);
	widgetScroll->move(311,0);
	widgetScroll->setStyleSheet("background-image: url(:/images/61.png); border:0px;");
	QPushButton *pushButton5=new QPushButton(QApplication::translate("bloghomepage", "5", 0, QApplication::UnicodeUTF8),widgetScroll);
	connect(pushButton5, SIGNAL(clicked()), this, SLOT(scrolltoitem()));
	QWidget *widget1=new QWidget(tab2);
	widget1->resize(360,518);
	widget1->move(0,0);
	widget1->setStyleSheet("background-image: url(:/images/54.jpg);");
	QWidget *widget2=new QWidget(tab3);
	widget2->resize(360,518);
	widget2->move(0,0);
	widget2->setStyleSheet("background-image: url(:/images/54.jpg);");
	QPushButton *pushButtonBlogSquare=new QPushButton(QApplication::translate("bloghomepage", "\345\276\256\345\215\232\345\271\277\345\234\272", 0, QApplication::UnicodeUTF8),tab2);
	pushButtonBlogSquare->setGeometry(QRect(97, 170, 166, 51));
	pushButtonBlogSquare->setFocusPolicy(Qt::NoFocus);
	connect(pushButtonBlogSquare, SIGNAL(clicked()), this, SLOT(openblogsquare()));
	QPushButton *pushButtonBlogConcern=new QPushButton(QApplication::translate("bloghomepage", "\346\210\221\345\205\263\346\263\250\347\232\204", 0, QApplication::UnicodeUTF8),tab2);
	pushButtonBlogConcern->setGeometry(QRect(97, 240, 166, 51));
	pushButtonBlogConcern->setFocusPolicy(Qt::NoFocus);
	connect(pushButtonBlogConcern, SIGNAL(clicked()), this, SLOT(openblogconcern()));
	QPushButton *pushButtonBlogPublish=new QPushButton(QApplication::translate("bloghomepage", "\346\210\221\345\217\221\350\241\250\347\232\204", 0, QApplication::UnicodeUTF8),tab2);
	pushButtonBlogPublish->setGeometry(QRect(97, 310, 166, 51));
	pushButtonBlogPublish->setFocusPolicy(Qt::NoFocus);
	connect(pushButtonBlogPublish, SIGNAL(clicked()), this, SLOT(openblogpublish()));
	QPushButton *pushButtonBlogCircle=new QPushButton(QApplication::translate("bloghomepage", "\346\210\221\347\232\204\345\234\210\345\255\220", 0, QApplication::UnicodeUTF8),tab2);
	pushButtonBlogCircle->setGeometry(QRect(97, 380, 166, 51));
	pushButtonBlogCircle->setFocusPolicy(Qt::NoFocus);
	connect(pushButtonBlogCircle, SIGNAL(clicked()), this, SLOT(openblogcircle()));
	QPushButton *pushButtonActivityAll=new QPushButton(QApplication::translate("bloghomepage", "\345\275\223\345\211\215\346\264\273\345\212\250", 0, QApplication::UnicodeUTF8),tab3);
	pushButtonActivityAll->setGeometry(QRect(65, 100, 231, 51));
	pushButtonActivityAll->setStyleSheet("background-image: url(:/images/31.png);");
	pushButtonActivityAll->setFocusPolicy(Qt::NoFocus);
	connect(pushButtonActivityAll, SIGNAL(clicked()), this, SLOT(openactivityall()));
	QPushButton *pushButtonActivityMy=new QPushButton(QApplication::translate("bloghomepage", "\346\210\221\347\232\204\346\264\273\345\212\250", 0, QApplication::UnicodeUTF8),tab3);
	pushButtonActivityMy->setGeometry(QRect(65, 185, 231, 51));
	pushButtonActivityMy->setStyleSheet("background-image: url(:/images/31.png);");
	pushButtonActivityMy->setFocusPolicy(Qt::NoFocus);
	connect(pushButtonActivityMy, SIGNAL(clicked()), this, SLOT(openactivitymy()));
	QPushButton *pushButtonActivityNew=new QPushButton(QApplication::translate("bloghomepage", "\345\217\221\350\265\267\346\226\260\346\264\273\345\212\250", 0, QApplication::UnicodeUTF8),tab3);
	pushButtonActivityNew->setGeometry(QRect(65, 270, 231, 51));
	pushButtonActivityNew->setStyleSheet("background-image: url(:/images/31.png);");
	pushButtonActivityNew->setFocusPolicy(Qt::NoFocus);
	connect(pushButtonActivityNew, SIGNAL(clicked()), this, SLOT(openactivitynew()));
	//exit1 = new QAction(tr("Exit"), this);
	//exit1->setSoftKeyRole(QAction::NegativeSoftKey);
	//connect(exit1, SIGNAL(triggered()), this, SLOT(exitApplication()));
	//addAction(exit1);
	QPushButton *pushButtonRight=new QPushButton(this);
	pushButtonRight->setGeometry(QRect(0, 580, 180, 60));	
	pushButtonRight->setStyleSheet("border-image:url(:/images/56.png);border:0px;");
	pushButtonRight->setFocusPolicy(Qt::NoFocus);
	QPushButton *pushButtonLeft=new QPushButton(this);
	pushButtonLeft->setGeometry(QRect(180, 580, 180, 60));	
	pushButtonLeft->setStyleSheet("border-image:url(:/images/58.png);border:0px;");
	pushButtonLeft->setFocusPolicy(Qt::NoFocus);
	connect(pushButtonLeft, SIGNAL(clicked()), this, SLOT(exitApplication()));

}

bloghomepage::~bloghomepage()
{

}
void bloghomepage::scrolltoitem()
{   
	multiListWidget->scrollToItem(multiListWidget->item(3),QAbstractItemView::PositionAtCenter);
}
void bloghomepage::openblogsquare()
{   
    blogsquare *w=new blogsquare();
    w->showFullScreen();
    this->~bloghomepage();   
}
void bloghomepage::openblogconcern()
{
    blogconcern *w=new blogconcern();
    w->showFullScreen();   
    this->~bloghomepage();
}
void bloghomepage::openblogpublish()
{
    blogpublish *w=new blogpublish();
    w->showFullScreen(); 
    this->~bloghomepage();
}
void bloghomepage::openblogcircle()
{
    blogcircle *w=new blogcircle();
    w->showFullScreen();    
    this->~bloghomepage();
}
void bloghomepage::openactivityall()
{
    activityall *w=new activityall();
    w->showFullScreen();  
    this->~bloghomepage();
}
void bloghomepage::openactivitymy()
{
    activitymy *w=new activitymy();
    w->showFullScreen(); 
    this->~bloghomepage();
}
void bloghomepage::openactivitynew()
{
    activitynew *w=new activitynew();
    w->showFullScreen();   
    this->~bloghomepage();
}
void bloghomepage::exitApplication()
{
	qApp->exit();
}

